Skip to content

Conversation

@ArgoZhang
Copy link
Member

@ArgoZhang ArgoZhang commented Mar 22, 2025

Link issues

fixes #5690

Summary By Copilot

This pull request includes several changes to the BootstrapBlazor project, focusing on enhancing the Tab component by adding new features, improving existing functionality, and updating the codebase for better maintainability. The most important changes include adding toolbar support to the Tab component, updating the project dependencies, and refining the rendering logic.

Enhancements to Tab component:

  • Added toolbar support with options for refresh and fullscreen buttons in the Tab component. (src/BootstrapBlazor/Components/Tab/Tab.razor, src/BootstrapBlazor/Components/Tab/Tab.razor.cs, src/BootstrapBlazor/Components/Tab/Tab.razor.scss) [1] [2] [3]
  • Introduced TabItemContent class for managing the content rendering of tab items. (src/BootstrapBlazor/Components/Tab/TabItemContent.cs)
  • Added TabToolbarRefreshButton component to handle refresh functionality in the toolbar. (src/BootstrapBlazor/Components/Tab/TabToolbarRefreshButton.razor, src/BootstrapBlazor/Components/Tab/TabToolbarRefreshButton.razor.cs) [1] [2]

Dependency updates:

  • Updated BootstrapBlazor.BootstrapIcon package version from 9.0.1 to 9.0.2. (src/BootstrapBlazor.Server/BootstrapBlazor.Server.csproj)

Codebase improvements:

  • Refined method names for better clarity and consistency in Tab.razor. (src/BootstrapBlazor/Components/Tab/Tab.razor) [1] [2]
  • Removed redundant code and optimized the rendering process in Tab.razor.cs. (src/BootstrapBlazor/Components/Tab/Tab.razor.cs) [1] [2]

Regression?

  • Yes
  • No

Risk

  • High
  • Medium
  • Low

Verification

  • Manual (required)
  • Automated

Packaging changes reviewed?

  • Yes
  • No
  • N/A

☑️ Self Check before Merge

⚠️ Please check all items below before review. ⚠️

  • Doc is updated/provided or not needed
  • Demo is updated/provided or not needed
  • Merge the latest code from the main branch

Summary by Sourcery

Adds a toolbar to the Tab component with refresh and fullscreen button options.

New Features:

  • Adds a toolbar to the Tab component with refresh and fullscreen button options.
  • Introduces a TabToolbarRefreshButton component for handling refresh functionality in the toolbar.

Tests:

  • Adds tests for the new Tab toolbar functionality.

@bb-auto bb-auto bot added the enhancement New feature or request label Mar 22, 2025
@sourcery-ai
Copy link
Contributor

sourcery-ai bot commented Mar 22, 2025

Reviewer's Guide by Sourcery

This pull request introduces a toolbar to the Tab component, which includes refresh and fullscreen button options. It also refactors the Tab component to use a TabItemContent component for managing tab item content rendering. Additionally, the BootstrapBlazor.BootstrapIcon package version is updated, and the codebase is improved for clarity and consistency.

Sequence diagram for refreshing a TabItem

sequenceDiagram
    participant Tab
    participant TabItem
    participant TabItemContent

    Tab->>Tab: OnRefreshAsync()
    Tab->>Tab: TabItems.FirstOrDefault(i => i.IsActive)
    alt item is not null
        Tab->>TabItem: Refresh(_cache)
        TabItem->>TabItemContent: Render()
        TabItemContent->>TabItemContent: _renderHandle.Render(BuildRenderTree)
    end
Loading

Class diagram for TabToolbarRefreshButton component

classDiagram
    class TabToolbarRefreshButton {
        string? Icon
        Func<Task>? OnClickAsync
        Task OnClick()
    }
Loading

File-Level Changes

Change Details Files
Added toolbar support to the Tab component, including refresh and fullscreen buttons.
  • Added ShowToolbar parameter to control toolbar visibility.
  • Added ShowFullscreenToolbarButton parameter to control fullscreen button visibility.
  • Added ShowRefreshToolbarButton parameter to control refresh button visibility.
  • Added RefreshToolbarButtonIcon parameter to customize the refresh button icon.
  • Added a new TabToolbarRefreshButton component to handle refresh functionality.
  • Added styles for the toolbar in the Tab component.
src/BootstrapBlazor/Components/Tab/Tab.razor
src/BootstrapBlazor/Components/Tab/Tab.razor.cs
src/BootstrapBlazor/Components/Tab/Tab.razor.scss
src/BootstrapBlazor/Components/Tab/TabToolbarRefreshButton.razor
src/BootstrapBlazor/Components/Tab/TabToolbarRefreshButton.razor.cs
src/BootstrapBlazor.Server/Components/Layout/ComponentLayout.razor
src/BootstrapBlazor.Server/Components/Samples/Tabs.razor
test/UnitTest/Components/TabTest.cs
Introduced a TabItemContent component to manage the rendering of tab item content.
  • Created a TabItemContent class to encapsulate the rendering logic for tab item content.
  • Utilized a concurrent dictionary to cache TabItemContent instances for each TabItem.
src/BootstrapBlazor/Components/Tab/Tab.razor
src/BootstrapBlazor/Components/Tab/Tab.razor.cs
src/BootstrapBlazor/Components/Tab/TabItemContent.cs
src/BootstrapBlazor/Extensions/TabItemExtensions.cs
Updated the BootstrapBlazor.BootstrapIcon package version.
  • Updated the package version from 9.0.1 to 9.0.2 in the BootstrapBlazor.Server project.
src/BootstrapBlazor.Server/BootstrapBlazor.Server.csproj
Refactored code for clarity and removed redundancy.
  • Refined method names in Tab.razor for better clarity.
  • Removed redundant code and optimized the rendering process in Tab.razor.cs.
src/BootstrapBlazor/Components/Tab/Tab.razor
src/BootstrapBlazor/Components/Tab/Tab.razor.cs

Assessment against linked issues

Issue Objective Addressed Explanation
#5690 Add a ShowToolbar parameter to the Tab component.

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!
  • Generate a plan of action for an issue: Comment @sourcery-ai plan on
    an issue to generate a plan of action for it.

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@bb-auto bb-auto bot added this to the v9.4.0 milestone Mar 22, 2025
Copy link
Contributor

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We encountered an error and are unable to review this PR. We have been notified and are working to fix it.

You can try again by commenting this pull request with @sourcery-ai review, or contact us for help.

@ArgoZhang ArgoZhang merged commit 89e944c into main Mar 22, 2025
3 checks passed
@ArgoZhang ArgoZhang deleted the refactor-tab-toolbar branch March 22, 2025 12:05
@codecov
Copy link

codecov bot commented Mar 22, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 100.00%. Comparing base (b7ec338) to head (b12a5fc).
Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff            @@
##              main     #5691   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files          654       657    +3     
  Lines        29689     29770   +81     
  Branches      4213      4220    +7     
=========================================
+ Hits         29689     29770   +81     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(Tab): add ShowToolbar parameter

2 participants